const mysql = require("mysql");

const connection = mysql.createConnection({
  host: 'localhost',
  user: 'root',
  password: 'root',
  database: 'dbtest'  //是几个圆饼图标的数据库的名字，不是有小鲸鱼图标连接m名
});
connection.connect()
/* connection.query('SELECT 1 + 1 AS solution', function (error, results, fields) {
  if (error) throw error;
  console.log('The solution is: ', results[0].solution);
}); */


const sql = 'SELECT * FROM emp'; //查找的表
// 查
connection.query(sql, function (err, result) {
  if (err) {
    console.log('[SELECT ERROR ] ', err.message);
    return;
  }
  console.log('SELECT');
  console.log(result);
})

connection.end()
//已成功
